<script language="javascript">

    function repetido(ci)
    {
       alert('Ya existe una Autoridad Civil registrada\ncon la C.I. Nº '+ci);
    }

//Valida el envio del formulario
    function validar()
    {

        if (document.form1.nombre.value.length == 0 || document.form1.apellido.value.length == 0 || document.form1.ci.value.length == 0)
        {
            alert('Debe llenar todos los campos!');
            return 0;
        }

        var answer = confirm("¿Está seguro(a)?")
        if (answer)
            document.form1.submit();
        else
            return 0;

    }

    var nav4 = window.Event ? true : false;

    //Valida que solo se ingresen numeros
    function acceptNum(evt){
        // NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
        var key = nav4 ? evt.which : evt.keyCode;
        return (key <= 13 || (key >= 48 && key <= 57));
    }



</script>

<style type="text/css">
.asterisco {
	color: #F00;
}
#form1 table tr td div input {
	text-align: center;
}
</style>

<form id="form1" name="form1" method="post" action="../php/agregarAutoridad.php">
  <h2 align="center">Agregar Autoridad Civil</h2>
  <p align="center">&nbsp;</p>

    <table align="center" width="362" border="0">

        <tr>
            <td><span class="asterisco">*</span> C.I :</td>
            <td><input name="ci" type="text" id="ci" value="{ci}" maxlength="10" onKeyPress="return acceptNum(event)"/></td>
            <td>ej: 12567987</td>
        </tr>
        <tr>
            <td width="92"><span class="asterisco">*</span> Nombre:</td>
            <td width="170"><input name="nombre" type="text" id="nombre" value="{nombre}" maxlength="50"/></td>
            <td width="114">&nbsp;</td>
        </tr>
        <tr>
            <td width="92"><span class="asterisco">*</span> Apellido:</td>
            <td width="170"><input name="apellido" type="text" id="apellido" value="{apellido}" maxlength="50"/></td>
            <td width="114">&nbsp;</td>
        </tr>

    </table>
    <table align="center" width="400" border="0">
<tr>
            <td colspan="2"><div align="center">
                    <input type="button" value="Agregar" onclick="validar()"/>
                </div></td>
      </tr>
  </table>
    <table align="center" width="228" border="0">
        <tr>
            <td width="222" height="21" colspan="2" align="center">
                <p><a href="../PHP/autoridadesCiviles.php">Cancelar</a></p>
            </td>
        </tr>
    </table>

</form>